package cn.virens.oauth.service;

import cn.virens.common.exception.APIException;
import cn.virens.oauth.request.principal.DelegatePrincipal;
import cn.virens.oauth.subject.Subject;

public interface AuthenticationService extends AuthenticationServiceBase {

    /**
     * 检查是否拥有权限(OR)
     */
    boolean hasPermissions(Subject subject, String... permissions) throws APIException;

    /**
     * 检查是否拥有角色(OR)
     */
    boolean hasRoles(Subject subject, String... roleIdentifiers) throws APIException;

    /**
     * 刷新登录令牌过期时间
     */
    DelegatePrincipal refresh(DelegatePrincipal principal) throws APIException;

    /**
     * 缓存过期时间(天)
     */
    Integer getExpire() throws APIException;

    /**
     * 获取缓存加密密钥
     */
    String getAeskey() throws APIException;

}
